package com.huqu.daoimpl;

import java.sql.Types;
import java.util.ArrayList;
import java.util.List;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Repository;

import com.huqu.basedao.QbDaoSupport;
import com.huqu.basedao.QbEntityMapper;
import com.huqu.basedao.QbSqlParam;
import com.huqu.dao.S100Dao;
import com.huqu.entities.S100;
import com.huqu.utils.ApplicationConstant;
import com.huqu.utils.SqlNames;

@Repository(value = ApplicationConstant.REPOSITORY_NAME_S100)
@Scope("prototype")
public class S100DaoImpl extends QbDaoSupport implements S100Dao {

	@Override
	public List<S100> ListOfTabS100(int ps100, int sn107, int sn108) {
		List<QbSqlParam> listParams = new ArrayList<QbSqlParam>();
		listParams.add(new QbSqlParam(Types.INTEGER, ps100));
		listParams.add(new QbSqlParam(Types.INTEGER, sn107));
		listParams.add(new QbSqlParam(Types.INTEGER, sn108));
		setQueenBListSqlParams(listParams);
		// set sql name
		setQueenBSqlName(SqlNames.LISTOFTABS100);
		// set row mapper
		setQueenBEntityMapper(new QbEntityMapper(S100.class));
		executeQueenBQuery();
		List<S100> listS100 = (List<S100>) getListReturn();
		return listS100;
	}

	@Override
	public int InsertTabS100(int ps100, String sv101, String sv102,
			String sv103, int sn107, int sn108) {
		List<QbSqlParam> listParams = new ArrayList<QbSqlParam>();
		listParams.add(new QbSqlParam(Types.INTEGER, ps100));
		listParams.add(new QbSqlParam(Types.CHAR, sv101));
		listParams.add(new QbSqlParam(Types.CHAR, sv102));
		listParams.add(new QbSqlParam(Types.CHAR, sv103));
		listParams.add(new QbSqlParam(Types.INTEGER, sn107));
		listParams.add(new QbSqlParam(Types.INTEGER, sn108));
		setQueenBListSqlParams(listParams);
		// set fuction
		setQbFunction(true);
		setQbFunctionReturnType(Types.INTEGER);
		setQueenBSqlName(SqlNames.INSERTTABS100);
		executeQueenBQuery();
		int re = Integer.parseInt(getObjectReturnFunction().toString());
		return re;
	}

	@Override
	public List<S100> ListOfTabS100Check(String sv101) {
		List<QbSqlParam> listParams = new ArrayList<QbSqlParam>();
		listParams.add(new QbSqlParam(Types.CHAR, sv101));
		setQueenBListSqlParams(listParams);
		// set sql name
		setQueenBSqlName(SqlNames.LISTOFTABS100CHECK);
		// set row mapper
		setQueenBEntityMapper(new QbEntityMapper(S100.class));
		executeQueenBQuery();
		List<S100> listS100 = (List<S100>) getListReturn();
		return listS100;
	}


}
